package com.kk.test.connectionpool;

import java.sql.Connection;

/**
 * 数据源管理器
 */
public class DataSourceManager {
    static DataSourceConfig dataSourceConfig = new DataSourceConfig();
    static ConnectionPoolImpl connectionPool = new ConnectionPoolImpl(dataSourceConfig);

    /**
     * 从连接池获取连接对象
     * @return
     */
    public static Connection getConn(){
        return connectionPool.getConn();
    }

    /**
     * 关闭一个数据库连接
     */
    public static void close(Connection connection){
       connectionPool.releaseConn(connection);
    }
}
